package com.turing.draw.enums;

import lombok.Getter;

public enum OcrPageTaskStatusEnum {

    /**
     * 创建
     */
    CREATED(0, "created"),
    /**
     * 排队
     */
    QUEUING(1, "queuing"),
    /**
     * ocr任务处理中
     */
    OCRTASKPROCESSING(2, "ocr task processing"),

    /**
     * ocr任务成功
     */
    OCRTASKFINISHED(3, "ocr task finished"),

    /**
     * ocr任务失败
     */
    OCRTASKFAILED(4, "ocr task failed"),

    /**
     * 不存在
     */
    NOTEXIST(-1,"not exist");

    @Getter
    private Integer code;

    @Getter
    private String name;

    OcrPageTaskStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static FileStatusEnum getEnum(Integer index) {
        FileStatusEnum[] fileStatusEnums = FileStatusEnum.values();
        for (FileStatusEnum anFileStatusEnum : fileStatusEnums) {
            if (index.equals(anFileStatusEnum.getCode())) {
                return anFileStatusEnum;
            }
        }
        return null;
    }

}
